#{extends 'main.html' /} #{set title:'Home' /}
<!-- @author Heidi eltoukhy

this page retrieves a list with all the community lists requests sent to a user with two options of either "Accepting" or "Rejecting" it -->

<body style="background-color: White;">
<body>
	<h2
		style="background-color: #FF6600; font-family: Arial; font-size: 20px">
		<p style="color: white;">
			<i>Your CommunityLists Request:</i>
		</p>
	</h2>

	#{ifnot communityRequests}
	<p
		style="background-color: #778899; width: 300px; text-align: top; font-size: 20px;">
		You Have No Communitylist Requests !!</p>
	#{/ifnot}
	<script type="text/javascript">
		function show_alert() {
			alert("you have successfully accepted the community list invitation ");
		}
	</script>
	#{if !communityRequests.empty}
	<table width="300" id="dataTable" background="lightblue" ; border="2"
		; BORDERCOLOR=#FF6600>
		<tr>
			<th
				style="background-color: #778899; font-family: Arial; font-size: 20px"><p
					style="color: white;">Request</p></th>
			<th
				style="background-color: #778899; font-family: Arial; font-size: 20px"><p
					style="color: white;">Action</p></th>
			<th
				style="background-color: #778899; font-family: Arial; font-size: 20px"><p
					style="color: white;">Action</p></th>#{list items:communityRequests,as:'commListRequests'}
		</tr>
		<td>
			<ul>
				<li><h4>
						Request From:
						${models.RegisteredUser.findById(commListRequests.requesterID).name}
						<br>
					</h4>
				</li>
			</ul>
			<ul>
				<li><h4>To Join The Community List:
						${models.CommunityList.findById(commListRequests.CommListId).name}</h4>
				</li>
			</ul>
		</td>
		<td>
			<!-- Begin @author Nada
2 buttons accept/reject-->
			<form action="@{CommunityLists.accept()}" method="GET">
				<div id="${commListRequests.id}">
					<button name="accept" type="submit" value="${commListRequests.id}">Accept</button>
				</div>
				<hr>
			</form>
		</td>
		<td>
			<div id="${commListRequests.id}">
				<br>
				<form action="@{CommunityLists.reject()}" method="GET">
					<div id="${commListRequests.id}">
						<button name="reject" type="submit" value="${commListRequests.id}">Reject</button>
				</form>
			</div>
			<hr>
		</td>
		<!-- End @author Nada-->
		#{/list}
	</table>
	#{/if}
	<br>
	<form>
		<li><a href="@{Application.viewProfile()}">Back to Profile
				Page</a></li>
	</form>
	<br>


</body>
